package com.crr.bean;

import com.crr.common.group.ISave;
import com.crr.common.group.IUpdate;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.logging.log4j.message.Message;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.*;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ApiModel("用户")
public class User {
    @Min(value = 1, message = "修改时用户id不能为空", groups = {IUpdate.class})
    @ApiModelProperty(name = "id", value = "用户id", hidden = true, required = false)
    int id;
    @NotBlank(message = "用户名不能为空")
    @Length(min = 6, message = "用户名至少6位", groups = {ISave.class, IUpdate.class})
    @ApiModelProperty(name = "name", value = "用户名", required = true)
    String account;
    /*@NotBlank(message = "密码不能为空")*/
    @NotNull(message = "密码不能为空", groups = {ISave.class, IUpdate.class})
    @Pattern(regexp = "^[a-zA-Z0-9]{8,12}$", message = "密码由字母，数字，下划线组成的8-12位", groups = {ISave.class, IUpdate.class})
    @ApiModelProperty(name = "psw", value = "用户密码", required = true)
    String password;
   @ApiModelProperty(value="用户类型",hidden = true)
    int type;

}
